<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display:none;"></div>
<div class="walk-register-buttons" style="float: right;">
	<a href="<?php echo( base_url() ); ?>cmb/member/homepage_logout/"><img src="<?php echo( base_url() ); ?>assets/images/buttons/logout1.gif" border="0" /></a>
</div>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );
			
		echo( form_open(base_url() . 'cmb/member_registration/admin_update_balavihar_attendance_process/', array('id' => 'balaviharAttendanceUpdateForm') ) );

		//Setup Balavihar fields with edit of status field
		//----------------------------------------
		Spacer::Render(0, 20);
		
		Form::OpenFormItem('Student Center:', 260);
			echo( form_label($centername, 'pinfo', 'style="width: 20px;" ') );
		Form::CloseFormItem();

		Form::OpenFormItem('Student Session:', 260);
			echo( form_label($session, 'pinfo', 'style="width: 20px;" ') );
		Form::CloseFormItem();

		Form::OpenFormItem('Student Grade:', 260);
			echo( form_label($grade, 'pinfo', 'style="width: 20px;" ') );
		Form::CloseFormItem();

		Form::OpenFormItem('Balavihar week:', 260);
			echo( form_label($weekdate, 'pinfo', 'style="width: 20px;" ') );
		Form::CloseFormItem();
		echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');
		Spacer::Render(0, 20);

		foreach($bvattendancearr as $bvarec)
		{
			//Form::OpenFormItem('',1);
				$attdOptions = array('1'=>'Present', '0'=>'NotPresent', '2'=>'NA');
				echo( form_dropdown('status'.$bvarec[0], $attdOptions, $bvarec[4], 'id="status'.$bvarec[0].'" style="width: 100px;" ') );
				echo( form_label('&nbsp&nbsp&nbsp&nbsp&nbsp', 'pinfo', 'style="width: 10px;" ') );
				echo( form_label($bvarec[1].' '.$bvarec[2].' '.$bvarec[3], 'pinfo', 'style="width: 100px;" ') );
				Spacer::Render(0, 5);
			//Form::CloseFormItem();
		}

		echo( form_close() );
?>
	<div class="form-button-container">
		<a href="javascript: validate();"><img src="<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif" border="0" onmouseover="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_over1.gif';" onmousedown="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_on1.gif';" onmouseup="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif';" onmouseout="this.src = '<?php echo( base_url() );?>assets/images/buttons/submit_off1.gif';" />
	</div>	

</div>

<script type="text/javascript">
	function validate()
	{
		new Ajax.Request(baseUrl + 'validation/member_registration_validation/validate_balavihar_attendance_update/', 
		{
			method:'post',
			parameters: Form.serialize( $('balaviharAttendanceUpdateForm') ),
		  	onSuccess: function(response)
			{
				var result = response.responseText;
				
				if( result == 'VALIDATION_SUCCESS' )
				{
					$('balaviharAttendanceUpdateForm').submit();
				}
				else
				{
					$('validationErrors').innerHTML = result;
					$('validationErrors').show();
					Effect.ScrollTo('validationErrors', { duration:'0.2', offset:-20 });
				}
			},
			onFailure: function(response){var result = response.responseText; $('validationErrors').innerHTML = result;
					$('validationErrors').show();alert('failed') }
		});
	}
</script>
